/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session02;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author macbookpro
 */
public class AccountDeposit extends Thread{
    private Account a;

    public AccountDeposit(Account a) {
        this.a = a;
    }
    
    public void run(){
        synchronized(a){
            for(int i=0; i<100; i++){
                a.deposit(10);
                System.out.println(a.getBalance());
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
                Logger.getLogger(AccountDeposit.class.getName()).log(Level.SEVERE, null, ex);
            }
            }
        }
    }
}
